/*
 * Copyright 2016 drakeet. https://github.com/drakeet
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.foxmail.aroundme.mutlitype;

import android.support.annotation.NonNull;

import java.util.List;

/**
 * @author drakeet
 */
public class MultiTypeAsserts {

    private MultiTypeAsserts() {
        throw new AssertionError();
    }


    /**
     * Make the exception to occur in your class for debug and index.
     *
     * @throws ProviderNotFoundException If check failed.
     * @throws IllegalArgumentException  If your Items/List is empty.
     */
    @SuppressWarnings("unchecked")
    public static void assertAllRegistered(
            @NonNull MultiTypeAdapter adapter,
            @NonNull List<BaseItem> items)
            throws ProviderNotFoundException, IllegalArgumentException, IllegalAccessError {

        if (items.size() == 0) {
            throw new IllegalArgumentException("Your Items/List is empty.");
        }
        for (BaseItem item : items) {
            adapter.indexOf(adapter.flattenClass(item));
        }
        /* All passed. */
    }

}
